package org.aj.web.exception.prop;

import org.apache.commons.lang3.ObjectUtils;

/**
 * description 邮件配置
 *
 * @author aj
 * date 2024/10/27 18:31
 */
public class MailProperties {

    /**
     * 接收邮件的地址
     */
    private String[] receiveMailAddr;

    /**
     * 发送方的邮件地址
     */
    private String sendMailAddr;

    /**
     * 邮件标题
     */
    private String mailTitle = "接口异常";

    public String[] getReceiveMailAddr() {
        return receiveMailAddr;
    }

    public void setReceiveMailAddr(String[] receiveMailAddr) {
        this.receiveMailAddr = receiveMailAddr;
    }

    public String getSendMailAddr() {
        return sendMailAddr;
    }

    public void setSendMailAddr(String sendMailAddr) {
        this.sendMailAddr = sendMailAddr;
    }

    public String getMailTitle() {
        return mailTitle;
    }

    public void setMailTitle(String mailTitle) {
        this.mailTitle = mailTitle;
    }

    public void checkArg() {
        if(null == sendMailAddr || ObjectUtils.isEmpty(receiveMailAddr)){
            throw new IllegalArgumentException(" if you want to enable mail. please receiveMailAddr sendMailAddr must not empty.");
        }
    }
}
